package cn.jjxx.modules.iface.controller;

import cn.jjxx.core.model.AjaxJson;
import cn.jjxx.core.query.wrapper.EntityWrapper;
import cn.jjxx.modules.record.entity.Achievement;
import cn.jjxx.modules.record.entity.ConstructionCapacity;
import cn.jjxx.modules.record.entity.DevelopmentOfMembers;
import cn.jjxx.modules.record.entity.Equipment;
import cn.jjxx.modules.record.entity.OutputValueAmount;
import cn.jjxx.modules.record.entity.PartyCleanGovernment;
import cn.jjxx.modules.record.entity.PartyOrganization;
import cn.jjxx.modules.record.entity.PersonnelOnDuty;
import cn.jjxx.modules.record.entity.RecordOrganization;
import cn.jjxx.modules.record.entity.RecordQualification;
import cn.jjxx.modules.record.entity.TalentStatistics;
import cn.jjxx.modules.record.entity.TechnologicalAchievements;
import cn.jjxx.modules.record.service.IAchievementService;
import cn.jjxx.modules.record.service.IConstructionCapacityService;
import cn.jjxx.modules.record.service.IDevelopmentOfMembersService;
import cn.jjxx.modules.record.service.IEquipmentService;
import cn.jjxx.modules.record.service.IOutputValueAmountService;
import cn.jjxx.modules.record.service.IPartyCleanGovernmentService;
import cn.jjxx.modules.record.service.IPartyOrganizationService;
import cn.jjxx.modules.record.service.IPersonnelOnDutyService;
import cn.jjxx.modules.record.service.IRecordOrganizationService;
import cn.jjxx.modules.record.service.IRecordQualificationService;
import cn.jjxx.modules.record.service.ITalentStatisticsService;
import cn.jjxx.modules.record.service.ITechnologicalAchievementsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.LinkedHashMap;
import java.util.List;

@Controller
@RequestMapping("/iface/roadbridgebigscreen")
public class RoadBridgeBigscreenController {

    @Autowired
    protected IRecordQualificationService recordQualificationService;
    @Autowired
    protected IRecordOrganizationService recordOrganizationService;
    @Autowired
    protected ITalentStatisticsService talentStatisticsService;
    @Autowired
    protected IPersonnelOnDutyService personnelOnDutyService;
    @Autowired
    protected IPartyOrganizationService partyOrganizationService;
    @Autowired
    protected IPartyCleanGovernmentService partyCleanGovernmentService;
    @Autowired
    protected IDevelopmentOfMembersService developmentOfMembersService;
    @Autowired
    protected IAchievementService achievementService;
    @Autowired
    protected IOutputValueAmountService outputValueAmountService;
    @Autowired
    protected ITechnologicalAchievementsService technologicalAchievementsService;
    @Autowired
    protected IConstructionCapacityService constructionCapacityService;
    @Autowired
    protected IEquipmentService equipmentService;

    /**
     * @Description: 获取路桥大屏数据 .<br>
     * @author zx .<br>
     * @date 2021-1-5<br>
     */

    @RequestMapping(value = "/getRoadBridgeBigscreen",method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public AjaxJson getDetailList(){
        AjaxJson ajaxJson = new AjaxJson();
        LinkedHashMap<String, Object> extend = new LinkedHashMap<String, Object>();
        try {
            //资质-recordqualification
            EntityWrapper<RecordQualification> entityWrapper = new EntityWrapper<RecordQualification>(RecordQualification.class);
            entityWrapper.orderBy("sort", true);
            List<RecordQualification> list = recordQualificationService.selectList(entityWrapper);
            extend.put("recordqualification", list);

            //组织机构-recordorganization
            EntityWrapper<RecordOrganization> entityWrapper1 = new EntityWrapper<RecordOrganization>(RecordOrganization.class);
            entityWrapper1.orderBy("sort", true);
            List<RecordOrganization> list1 = recordOrganizationService.selectList(entityWrapper1);
            extend.put("recordorganization", list1);

            //人才统计-talentstatistics
            EntityWrapper<TalentStatistics> entityWrapper2 = new EntityWrapper<TalentStatistics>(TalentStatistics.class);
            entityWrapper2.orderBy("sort", true);
            List<TalentStatistics> list2 = talentStatisticsService.selectList(entityWrapper2);
            extend.put("talentstatistics", list2);

            //人员在岗情况-personnelonduty
            EntityWrapper<PersonnelOnDuty> entityWrapper3 = new EntityWrapper<PersonnelOnDuty>(PersonnelOnDuty.class);
            List<PersonnelOnDuty> list3 = personnelOnDutyService.selectList(entityWrapper3);
            extend.put("personnelonduty", list3);

            //党组织-partyorganization
            EntityWrapper<PartyOrganization> entityWrapper4 = new EntityWrapper<PartyOrganization>(PartyOrganization.class);
            List<PartyOrganization> list4 = partyOrganizationService.selectList(entityWrapper4);
            extend.put("partyorganization", list4);

            //党风廉政-partycleangovernment
            EntityWrapper<PartyCleanGovernment> entityWrapper5 = new EntityWrapper<PartyCleanGovernment>(PartyCleanGovernment.class);
            List<PartyCleanGovernment> list5 = partyCleanGovernmentService.selectList(entityWrapper5);
            extend.put("partycleangovernment", list5);

            //党员发展-developmentofmembers
            EntityWrapper<DevelopmentOfMembers> entityWrapper6 = new EntityWrapper<DevelopmentOfMembers>(DevelopmentOfMembers.class);
            List<DevelopmentOfMembers> list6 = developmentOfMembersService.selectList(entityWrapper6);
            extend.put("developmentofmembers", list6);

            //业绩-achievement
            EntityWrapper<Achievement> entityWrapper7 = new EntityWrapper<Achievement>(Achievement.class);
            List<Achievement> list7 = achievementService.selectList(entityWrapper7);
            extend.put("achievement", list7);

            //产值与新签合同额-outputvalueamount
            EntityWrapper<OutputValueAmount> entityWrapper8 = new EntityWrapper<OutputValueAmount>(OutputValueAmount.class);
            entityWrapper8.orderBy("year", true);
            List<OutputValueAmount> list8 = outputValueAmountService.selectList(entityWrapper8);
            extend.put("outputvalueamount", list8);

            //技术成果-technologicalachievements
            EntityWrapper<TechnologicalAchievements> entityWrapper9 = new EntityWrapper<TechnologicalAchievements>(TechnologicalAchievements.class);
            entityWrapper9.orderBy("sort", true);
            List<TechnologicalAchievements> list9 = technologicalAchievementsService.selectList(entityWrapper9);
            extend.put("technologicalachievements", list9);

            //施工能力-constructioncapacity
            EntityWrapper<ConstructionCapacity> entityWrapper10 = new EntityWrapper<ConstructionCapacity>(ConstructionCapacity.class);
            List<ConstructionCapacity> list10 = constructionCapacityService.selectList(entityWrapper10);
            extend.put("constructioncapacity", list10);

            //装备-equipment
            EntityWrapper<Equipment> entityWrapper11 = new EntityWrapper<Equipment>(Equipment.class);
            List<Equipment> list11 = equipmentService.selectList(entityWrapper11);
            extend.put("equipment", list11);

            ajaxJson.setExtend(extend);
        } catch(Exception e) {
            ajaxJson.fail("操作失败");
            e.printStackTrace();
        }
        return ajaxJson;
    }
    

    @RequestMapping(value = "/getRecordOrganization",method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public AjaxJson getRecordOrganization(){
        AjaxJson ajaxJson = new AjaxJson();
        try {
            //组织机构-recordorganization
            EntityWrapper<RecordOrganization> entityWrapper1 = new EntityWrapper<RecordOrganization>(RecordOrganization.class);
            entityWrapper1.orderBy("sort", true);
            List<RecordOrganization> list = recordOrganizationService.selectList(entityWrapper1);

            ajaxJson.setData(list);
        } catch(Exception e) {
            ajaxJson.fail("操作失败");
            e.printStackTrace();
        }
        return ajaxJson;
    }
    

    

    @RequestMapping(value = "/getRecordqualification",method = { RequestMethod.GET, RequestMethod.POST })
    @ResponseBody
    public AjaxJson getRecordqualification(){
        AjaxJson ajaxJson = new AjaxJson();
        try {
            //资质-recordqualification
            EntityWrapper<RecordQualification> entityWrapper = new EntityWrapper<RecordQualification>(RecordQualification.class);
            entityWrapper.orderBy("sort", true);
            List<RecordQualification> list = recordQualificationService.selectList(entityWrapper);

            ajaxJson.setData(list);
        } catch(Exception e) {
            ajaxJson.fail("操作失败");
            e.printStackTrace();
        }
        return ajaxJson;
    }
}
